home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************/
- /* */
- /* echo.c - program to convert fonts */
- /* from ***.FED to ***.FNT */
- /* format for use with GDOS */
- /* */
- /* compiles as "echo.ttp" */
- /* argument 1 - name.FED */
- /* argument 2 - name.FNT */
- /* */
- /* This program converts .FED files, which */
- /* are in standard data format (high byte */
- /* first) to .FNT files in INTEL format (low */
- /* byte first) - also resets the offset table */
- /* and data pointers to point to the data */
- /* postion in the file, as GDOS expects. */
- /* More info in the GEM/atari.st topic. */
- /* */
- /* written in Megamax C for the Atari ST */
- /* */
- /* John D. Ruley - August 1985 */
- /* */
- /*******************************************************************/
-
- #include <stdio.h>
- #include <osbind.h>
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- int i,j;
- char in_name[30],out_name[30],in_buf[4],out_buf[4];
- int in_chan,out_chan;
-
- if(argc < 2){
- printf("bad arguments\n");
- i = Cconin();
- }
-
- strcpy(in_name,argv[1]); /* file for input "xxx.FED" */
- strcpy(out_name,argv[2]); /* file for output "xx.FNT" */
-
- in_chan = Fopen(in_name,0);
- out_chan = Fcreate(out_name,0);
-
- printf("converting %s to GDOS .FNT format as %s\n",in_name,out_name);
-
- j = Fread(in_chan,2L,in_buf); /* font I.D. */
- out_buf[1] = in_buf[0];
- out_buf[0] = in_buf[1];
- Fwrite(out_chan,2L,out_buf);
-
- j = Fread(in_chan,2L,in_buf); /* font size */
- out_buf[1] = in_buf[0];
- out_buf[0] = in_buf[1];
- Fwrite(out_chan,2L,out_buf);
-
- for(i = 0;i<16;i++){ /* face name */
- j = Fread(in_chan,2L,in_buf);
- Fwrite(out_chan,2L,in_buf);
- }
-
- for(i = 0;i<16;i++){ /* assorted stuff */
- j = Fread(in_chan,2L,in_buf);
- out_buf[1] = in_buf[0];
- out_buf[0] = in_buf[1];
- Fwrite(out_chan,2L,out_buf);
- }
-
- for(i=0;i<2;i++){ /* offset pointers */
- j = Fread(in_chan,4L,in_buf);
- out_buf[0] = 88; /* 058 Hex - start of data */
- out_buf[1] = 0;
- out_buf[2] = 0;
- out_buf[3] = 0;
- Fwrite(out_chan,4L,out_buf);
- }
-
- j = Fread(in_chan,4L,in_buf); /* pointer to font data */
- out_buf[0] = 90; /* 025A Hex - */
- out_buf[1] = 2;
- out_buf[2] = 0;
- out_buf[3] = 0;
- Fwrite(out_chan,4L,out_buf);
- /* whatever's left... */
-
- while((i = Fread(in_chan,2L,in_buf)) != 0){
- out_buf[1] = in_buf[0];
- out_buf[0] = in_buf[1];
- Fwrite(out_chan,2L,out_buf);
- }
-
- Fclose(in_chan); /* close the files */
- Fclose(out_chan);
-
- printf("inversion is complete\n"); /* and quit ! */
- Cconin(); /* after any char */
- exit();
- }
-